import http from "../utils/http";
// 用户登录
let userLogin = (data:UserLoginParams):Promise<any>=> http(`login`,"post",data);
// 获取用户左侧菜单权限列表
let getMenus = ():Promise<any>=>http(`menus`,"get");
// 获取用户列表api
let getUsersList = (data:UsersListParams)=>http(`users`,"get",data)
//修改用户状态
let updateUserState = ( uId:number, type:boolean)=>http(`users/${uId}/state/${type}`,'put')

//添加用户
let addusers = (data:AddUsersParams)=>http(`users`,'post',data);
//编辑用户
let updateUsers = (id:number,data:AddUsersParams) =>http(`users/${id}`,'put',data)
// 分配角色
let setUserRoles = (data:SetRolesType,id?:number)=>http(`users/${id}/role`,'put',data)
export {
    userLogin,
    getMenus,
    getUsersList,
    updateUserState,
    addusers,
    updateUsers,
    setUserRoles
}